perf(frontend): Implement Lazy Image Loading and Route Chunking for Faster Web App Initial Load#658
Conversation
…eton loaders for faster initial load Closes ritesh-1918#638 - Refactor Frontend/src/App.jsx: convert all 35+ page component imports to React.lazy() dynamic imports, grouped by route category (auth/user/admin/ master-admin/marketing/legal); auth pages and route guards remain eagerly loaded for instant critical path; each route wrapped in dedicated Suspense boundary; AnimatePresence moved to inner AppRoutes component so Router context is available - Add Frontend/src/components/ui/page-skeleton.jsx: two skeleton components — PageSkeleton (full shell with nav, sidebar, stat cards, and content rows) and MinimalSkeleton (centered card for auth/lobby pages); both use CSS animate-pulse shimmer and include aria role/label for accessibility
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@advikdivekar is attempting to deploy a commit to the ritesh Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@ritesh-1918 please review my PR, thank you |
|
Superb implementation, @advikdivekar! I've successfully resolved all conflicts in your PR and queued it for merging into
Keep up the outstanding work! Let's build together! 🔥 |
|
Hi @advikdivekar! 🙌 Thank you so much for your excellent contribution: "perf(frontend): Implement Lazy Image Loading and Route Chunking for Faster Web App Initial Load"! We really appreciate the high-quality code and effort you have put into the platform. Just a quick, friendly heads-up as we prepare our manual merging and verification queues—please make sure to complete all the mandatory community steps listed below. Once those manual steps are verified, we'll get your PR officially merged into the Let's build something amazing together! 🚀🔥 🌟 Community Support & Network Steps (Take 10 Seconds!)As we prepare our manual verification and merging queues, please make sure you have taken a moment to complete these required steps to finalize your points:
Note: Having these steps completed manually is required before your PR points are officially cleared. |
Summary
Fixes #638
This PR refactors
App.jsxto useReact.lazy()andSuspenseboundaries for all route-level components, dramatically reducing the initial JS bundle size on first load.Changes
Frontend/src/App.jsx— Full lazy routing refactorReact.lazy()dynamic importsAdminProtectedRoute,ProtectedRoute) remain eagerly loaded — tiny, needed before any lazy chunk loadsSuspenseboundary with context-appropriate fallbackAnimatePresencemoved to innerAppRoutescomponent souseLocation()hook works correctlyFrontend/src/components/ui/page-skeleton.jsx— Skeleton loader componentsPageSkeleton: full-app shell skeleton with top nav shimmer, sidebar shimmer, stat card grid, content rows with avatar placeholders — used for all authenticated routesMinimalSkeleton: centered card shimmer — used for auth, lobby, and legal pagesanimate-pulseshimmer and includerole="status"+aria-labelfor accessibilityBundle impact
Before: single
index.jschunk (~all pages bundled together)After: per-route chunks loaded on demand — landing page visits no longer download admin or user page code
Test Plan
npm run dev— app loads, no console errors/user/dashboard— PageSkeleton flashes briefly then content renders/admin/settings— admin chunk loads on demandnpm run build— verify Rollup outputs multiple chunks, vendor chunk present